import {useQuery} from 'react-query'
function getName(){
	return new Promise((resolve,reject)=>{
		setTimeout(()=>{
			//resolve('ok');
			reject('fail');
		},3000);
	});
}
function Query(){
    const {data,error,isLoading} = useQuery('getName',getName,{
        retry:0 //如果失败了重试3次
    });
    console.log(data,error,isLoading);
	if(isLoading){
		return <div>loading name....</div>;
	}
	if(error){
		return <div>load name error</div>;
	}
	return (
		<div>
			name:{data}
		</div>
	);
}
export default Query;